package com.example.text2.presenter;

import com.example.text2.http.Api;
import com.example.text2.moudle.Main_Moudle;
import com.example.text2.view.View;

/**
 * Created by 段傅华 on 2018/12/13.
 */

public class Presenter implements Main_Presenter, Main_Moudle.Finish {
    private Main_Moudle mMain_moudle;
    private View mView;

    public Presenter(Main_Moudle main_moudle, View view) {
        mMain_moudle = main_moudle;
        mView = view;
    }

    @Override
    public void getData(int data, Api api) {
        if (mView!=null){
            mMain_moudle.setData(data,api,this);
        }
    }

    @Override
    public void setSuccess(Object o, Api api) {
        if (mView!=null){
            mView.showSuccess(o,api);
        }
    }

    @Override
    public void setError(String error) {
        if (mView!=null){
            mView.showError(error);
        }
    }
}
